package Day2025_04_15;

import java.util.Scanner;

public class Demo03 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] s = in.nextLine().toCharArray();
        int n = s.length;
        int ret = 0;
        for (int i = 0; i < n; i++) {
            int left = i, right = i;
            while (left >= 0 && right < n) {
                if (!isNum(s, left, right)) {
                    ret = Math.max(ret, right - left + 1);
                    left--;
                    right++;
                }
            }
            left = i;
            right = i + 1;
            while (left >= 0 && right < n) {
                if (!isNum(s, left, right)) {
                    ret = Math.max(ret, right - left + 1);
                    left--;
                    right++;
                }
            }
        }
        System.out.println(ret);
    }
    private static boolean isNum (char[] s, int left, int right) {
        int n = left + (right - left) / 2;
        int l = n, r = n;
        boolean tmp = true;
        while (l >= left && r <= right) {
            if (s[left] != s[right]) {
                tmp = false;
                break;
            }
            l--;
            r++;
        }
        boolean ret = true;
        l = n;
        r = n + 1;
        while (l >= left && r <= right) {
            if (s[left] != s[right]) {
                ret = false;
                break;
            }
            l--;
            r++;
        }
        return tmp || ret;
    }
}
